use Curses;
use Component;

package DisplayManager;

@ISA=qw/Component/;

sub new{
    my $class = shift;
    my $self = {};

    bless $self, $class;
    $self->init(@_);

    return $self;
}

sub init{
    my $self = shift;
    $self->{INITIALIZED} = 0;

    $self->dependencies(qw//);
}


sub startscr{
    my $self = shift;

    Curses::initscr;
    Curses::raw;
    Curses::keypad(1);
    Curses::noecho;
    Curses::curs_set(0); # Hide cursor
}

sub dispose{
    Curses::endwin;
}

sub print{
    my $self = shift;
    my $str = shift;
    my ($x, $y) = (shift, shift);

    if (defined($x) && defined($y)){
	Curses::move($x, $y);
    }

    Curses::addstr($str);
}

sub move{
    my $self = shift;
    my ($x, $y) = (shift, shift);

    Curses::move($x, $y);
}

sub refresh{
    my $self = shift;
    my $str = shift;

    Curses::refresh;
}

1;
